/*
 * Copyright (c) 2007 Universidade Federal de Campina Grande
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package br.edu.ufcg.threadcontrol;

import java.util.List;

/*
 * Services offered for tests in order to obtain a better control of their
 * execution and avoid false negatives.
 */
public class ThreadControl {

	private List<ThreadConfiguration> threadsConfiguration;

	public ThreadControl() {
		super();
		this.reset();
	}

	public List<ThreadConfiguration> getThreadsConfiguration() {
		return this.threadsConfiguration;
	}

	public void prepare(List<ThreadConfiguration> threadsConfiguration) {
		this.threadsConfiguration = threadsConfiguration;
	}

	/**
	 * Waits until the specified thread configurations are obtained and then
	 * stops all other threads trying to modify the system.
	 * 
	 */
	public void waitUntilStateIsReached() {
		throwNotUsingAspectsException();
	}

	/**
	 * Throws a RuntimeException indicating that the classes that use this
	 * package should be compiled using AspectJ compiler.
	 */
	public static void throwNotUsingAspectsException() {
		throw new RuntimeException(
				"This class should be used only after compiling with aspects.");
	}

	public void proceed() {
		throwNotUsingAspectsException();
	}

	public void reset() {
		throwNotUsingAspectsException();
	}
}
